package org.sixtythousand.joker.netty;

import org.sixtythousand.joker.Wrapper;

import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;
import java.io.IOException;

/**
 * @author zhoulk
 * @date 2023/10/19 11:08
 * @desc
 */
public class ServletOutputStreamWrapper extends ServletOutputStream implements Wrapper<NettyServletOutputStream> {

    private NettyServletOutputStream source;

    protected ServletOutputStreamWrapper() {

    }

    @Override
    public boolean isReady() {
        return false;
    }

    @Override
    public void setWriteListener(WriteListener writeListener) {

    }

    @Override
    public void write(int b) throws IOException {

    }

    @Override
    public void write(byte[] b, int off, int len) throws IOException {
        source.write(b, off, len);
    }

    @Override
    public NettyServletOutputStream getSource() {
        return source;
    }

    @Override
    public void addSource(NettyServletOutputStream nettyServletOutputStream) {
        this.source = nettyServletOutputStream;
    }
}
